%include
:- lib(ic), lib(listut).

testTriangleTriangle(Path, OState, Arg, Result, NState) :-
	Path > 0,
	% Domains
	[Sa] :: -127 .. 128,
	[NSa] :: -127 .. 128,
	[Sb] :: -127 .. 128,
	[NSb] :: -127 .. 128,
	[Sc] :: -127 .. 128,
	[NSc] :: -127 .. 128,
	% Constraints
	Arg = [Sa, Sb, Sc],
	NState = [NSa, NSb, NSc],
	triangleTriangle(Path, OState, Arg, Result, NState),
	% Solving
	indomain(Sa),
	indomain(NSa),
	indomain(Sb),
	indomain(NSb),
	indomain(Sc),
	indomain(NSc).

triangleTriangle(1, [], [Sa, Sb, Sc], [], [NSideA, NSideB, NSideC]) :-
	% Precondition
	Sa + Sb #> Sc,
	Sb + Sc #> Sa,
	Sa + Sc #> Sb,
	% Postcondition
	NSideA #= Sa,
	NSideB #= Sb,
	NSideC #= Sc,
	% Invariant
	NSideA + NSideB #> NSideC,
	NSideB + NSideC #> NSideA,
	NSideA + NSideC #> NSideB.

